/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package DAL;

import DTO.dThanphien;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author HuyTQ
 */
public class Support {
    MyConnect conn;
    
    
    public Support ()
    {
    conn=new MyConnect();
    }
    public ResultSet Loadthanphienkt (String manv)
            {
            return conn.excuteQuery("select a.ma_tp [Mã Than Phiền], a.ma_khach [Mã Khách], a.ten_sp [Tên Sản Phẩm], a.noi_dung [Nội Dung],a.tinh_trang [Tình Trạng],a.bao_hanh [Bảo Hành],a.chi_phi [Chi Phí],a.fix [Fix] from than_phien a where a.ma_nv='"+manv+"';");
        }
    public ResultSet Searchthanphienkt (String matp)
        {
            return conn.excuteQuery("select a.ma_tp [Mã Than Phiền], a.ma_khach [Mã Khách], a.ten_sp [Tên Sản Phẩm], a.noi_dung [Nội Dung],a.tinh_trang [Tình Trạng],a.bao_hanh [Bảo Hành],a.chi_phi [Chi Phí],a.fix [Fix] from than_phien a where a.ma_tp Like '"+matp+"';");
        }
    public int Updatethanphienkt (dThanphien dtp) throws SQLException
        {
            return conn.executeUpdate("Update than_phien set tinh_trang=N'"+dtp.getTinh_trang().toString()+"',chi_phi='"+dtp.getChi_phi()+"' Where ma_tp='"+dtp.getMa_tp() +"';");
        }
      public int Updatefix () throws SQLException
        {
            return conn.executeUpdate("update than_phien set fix='1' where tinh_trang=N'Đã Xong';"
                    + "update than_phien set fix='0' where tinh_trang=N'Chưa Xử Lý';"
                    +"update than_phien set fix='0' where tinh_trang=N'Đang Xử Lý';");
        }
 }

